package org.cdivtc.exam.controller;


import io.swagger.annotations.*;
import org.cdivtc.exam.service.TeachersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

/**
 * <p>
 * 教师账户信息表 前端控制器
 * </p>
 *
 * @author xiaogoudashuai
 * @since 2025-03-27
 */

@Api(tags = "老师操作")
@RestController
public class TeachersController {
    @Autowired
    private TeachersService teachersService;
    @ApiOperation(value = "根据账号和密码进行登录操作，只需要账号和密码。返回个人信息和token字符串",
            notes = "<span style = 'color:red'>模拟操作，密码为明文密码</span>",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "account",type = "String",required = true),
            @ApiImplicitParam(name = "password",type = "String",required = true)
    })

    @PostMapping("teacher/login")
    @ApiParam
    public Map<String, Object> login(@RequestParam String account,
                                     @RequestParam String password) {
        return teachersService.login(account, password);
    }

    @GetMapping("teacher/update")
    @ApiOperation(value = "老师信息修改")
    @ApiParam
    @ApiImplicitParams({
            @ApiImplicitParam(name = "current",value = "当前页数",
                    defaultValue = "1",dataType = "Integer",paramType = "query"),
            @ApiImplicitParam(name = "size",value = "页面行数",
                    dataType = "Integer",paramType = "query",defaultValue = "10"),
            @ApiImplicitParam(name = "condition",value = "姓名或身份证的查询关键字",defaultValue = "String",paramType = "query"),
            @ApiImplicitParam(name = "user_type",value = "用户类型(1、管理员；2、物业；3、业主；)",dataType = "Integer",required = true)
    })
    public String sayHello() {
        return "Hello, World!";
    }

    @GetMapping("teacher/search")
    @ApiOperation(value = "老师类型学生老师信息统计")
    @ApiParam
    @ApiImplicitParams({
            @ApiImplicitParam(name = "current",value = "当前页数",
                    defaultValue = "1",dataType = "Integer",paramType = "query"),
            @ApiImplicitParam(name = "size",value = "页面行数",
                    dataType = "Integer",paramType = "query",defaultValue = "10"),
            @ApiImplicitParam(name = "condition",value = "姓名或身份证的查询关键字",defaultValue = "String",paramType = "query"),
            @ApiImplicitParam(name = "user_type",value = "用户类型(1、管理员；2、物业；3、业主；)",dataType = "Integer",required = true)
    })
    public String MMD() {
        return "Hello, World!";
    }
}


